#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "FacadeEditorWidget.h"
#include "FacadeRepositoryWidget.h"
#include "MainCentralWidget.h"
#include "NamedAction.h"
#include "ProjectEditorWidget.h"

#include "falcon/facade.h"

#include <QGraphicsScene>
#include <QMainWindow>
#include <QMap>
#include <QTextEdit>

namespace falcon {

extern bool curseTrackingFacade;
extern MainCentralWidget* mainCentralWidget;

class MainWindow : public QMainWindow {
    Q_OBJECT

public:
    MainWindow(QWidget* parent = nullptr);
    ~MainWindow();

public:
    void registerAction(NamedAction* action);
    NamedAction* actionOf(const QString& actionName);

private:
    void createDocks();
    void createMenus();
    void createActions();
    void createToolBar();
    void createStatusBar();

    void newLetter();
    void print();
    void insertCustomer(const QString& customer);
    void addParagraph(const QString& paragraph);

private slots:
    void newFile();
    void openFile();
    void closeFile();
    void saveFile();
    void saveAsFile();

    void copy();
    void cut();
    void paste();
    void undo();
    void redo();

    void about();
    void showtool();

private:
    //  动作
    QMap<QString, QMap<QString, NamedAction*>> _registerActions;
    QMap<QString, QDockWidget*> _dockWidgets;

    FacadeEditorWidget* facadeEditorWidget { nullptr };
    ProjectEditorWidget* projectEditorWidget { nullptr };
    FacadeRepositoryWidget* facadeRepositoryWidget { nullptr };
    MainCentralWidget* MainCentralWidgem { nullptr };
};

} // namespace falcon
#endif // MAINWINDOW_H
